package com.ormlite.activity.tool.button.event;

import java.text.SimpleDateFormat;
import java.util.Locale;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

import com.ormlite.activity.check.CheckEventActivity.EventSectionFragment;
import com.ormlite.activity.modify.ModifyEventActivity;
import com.ormlite.pojo.Event;

public class ModifyEventButton implements OnClickListener {

	private final EventSectionFragment eventSectionFragment;
	private final Event event;

	public ModifyEventButton(EventSectionFragment eventSectionFragment, Event event) {
		this.eventSectionFragment = eventSectionFragment;
		this.event = event;
	}

	@Override
	public void onClick(View v) {
		Intent intent = new Intent(eventSectionFragment.getActivity(), ModifyEventActivity.class);
		intent.putExtra("id", event.getId());
		intent.putExtra("name", event.getName());
		intent.putExtra("title", event.getMovie().getTitle());
		intent.putExtra("time", new SimpleDateFormat("dd-MM-yyyy--HH.mm", Locale.US).format(event.getTime()));
		intent.putExtra("comment", event.getComment());
		eventSectionFragment.startActivity(intent);
	}
}
